﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Admin.master" AutoEventWireup="true" CodeBehind="EmployeeEntry.aspx.cs" Inherits="Legazpi.Payroll.Web.Admin.EmployeeEntry" %>
<asp:Content ID="Content2" ContentPlaceHolderID="headContent" runat="server">    
<script type="text/javascript">
    $(document).ready(function () {
        $('#<%=SearchTxt.ClientID %>').autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: '<%=ResolveUrl("~/Webservices/EmployeeWebService.asmx/FetchEmployees")%>',
                    data: "{ 'employeeName': '" + request.term + "' }",
                    dataType: "json",
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    dataFilter: function (data) { return data; },
                    success: function (data) {
                        response($.map(data.d, function (item) {
                            return {
                                label: item.EmployeeName,
                                value: item.EmployeeName,
                                id: item.Id
                            }
                        }))
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert(textStatus);
                    }
                });
            },
            minLength: 2,
            select: function (event, ui) {
                var id = ui.item.id;
                var employeeName = ui.item.label;

                $('#<%=SearchTxt.ClientID %>').val(employeeName);
                $('#<%=EmployeeIdHidden.ClientID %>').val(id);
                $('#<%=SearchBtn.ClientID %>').click();             
            }
        });

        var positionDropList = $("#<%=PositionDropList.ClientID%>");

        $("#<%=DeployedDropList.ClientID%>").change(function () {
            positionDropList.removeAttr("disabled");
            if ($(this).val() != -1) {
                $.ajax({
                    url: '<%=ResolveUrl("~/Webservices/EmployeeWebService.asmx/FetchPositionBySectorId")%>',
                    data: "{ 'sectorId': " + $(this).val() + "}",
                    dataType: "json",
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    success: function (data) {
                        var _datas = eval("(" + data.d + ")");
                        var html = "<option value='0'>--Select--</option>";
                        $.each(_datas, function (index, object) {
                            html += "<option value='" + object.Value + "'>" + object.Text + "</option>";
                        });
                        positionDropList.html("");
                        positionDropList.html(html);
                        positionDropList.val("0");
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert(textStatus);
                    }
                });
            }
        });
    });
    
</script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="leftContent" runat="server">    
    <div class="grid_9">                                    
        <%if(IsSuccess) {%>
            <span class="notification n-success"><%=NotifyText %></span>                                                
        <%} %>     
        <div class="bottom-spacing">
            <div class="float-right">
                <a class="button" href="Employees.aspx">
                    <span><img width="12" height="9" alt="View List" src="../images/plus-small.gif" />View Employee List</span>
                </a>
            </div>
            <strong>Enter Name to Search:</strong>
            <asp:TextBox ID="SearchTxt" runat="server" CssClass="input-short"></asp:TextBox>
            <asp:Button ID="SearchBtn" runat="server" style="display:none"  OnClick="SearchBtn_Click"/>
        </div>        
    </div>    
   
    <div class="grid_5">
        <div class="module">
                <h2><span>Personal</span></h2>
                        
                <div class="module-body">
                    <p>
                        <label>Last Name:</label>
                        <asp:TextBox ID="LastNameTxt" runat="server" CssClass="input-long"></asp:TextBox>                                    
                        <asp:HiddenField ID="EmployeeIdHidden" runat="server"></asp:HiddenField>
                    </p>
                    <p>
                        <label>First Name:</label>
                        <asp:TextBox ID="FirstNameTxt" runat="server" CssClass="input-long"></asp:TextBox>
                    </p>
                    <p>
                        <label>Middle Name:</label>
                        <asp:TextBox ID="MidNameTxt" runat="server" CssClass="input-short"></asp:TextBox>
                    </p>
                    <p>
                        <label>NickName:</label>
                        <asp:TextBox ID="NickNameTxt" runat="server" CssClass="input-medium"></asp:TextBox>
                    </p>
                    <p>
                        <label>Date of Birth:</label>
                        <asp:DropDownList ID="MonthDroplist" runat="server" CssClass="input-short">
                        </asp:DropDownList>
                        <asp:DropDownList ID="DayDroplist" runat="server" CssClass="input-short">
                        </asp:DropDownList>
                        <asp:DropDownList ID="YearDroplist" runat="server" CssClass="input-short">
                        </asp:DropDownList>
                    </p>
                    <p>
                        <label>Place of Birth:</label>
                        <asp:TextBox ID="POBTxt" runat="server" CssClass="input-long"></asp:TextBox>
                    </p>
                    <p>
                        <label>Religion:</label>
                        <asp:TextBox ID="ReligionTxt" runat="server" CssClass="input-short"></asp:TextBox>
                    </p>
                    <p>                                    
                        <label>Sex:</label>
                        <asp:DropDownList ID="SexDropList" runat="server" CssClass="input-short">
                            <asp:ListItem Value="MALE"></asp:ListItem>
                            <asp:ListItem>FEMALE</asp:ListItem>
                        </asp:DropDownList>
                        </p> 
                        <p>                                                                                                          
                        <label>Civil Status:</label>                                  
                        <asp:DropDownList ID="CivilStatDropList" runat="server" CssClass="input-short">
                            <asp:ListItem>SINGLE</asp:ListItem>
                            <asp:ListItem>MARRIED</asp:ListItem>
                            <asp:ListItem>SEPARATED</asp:ListItem>
                        </asp:DropDownList>
                    </p>
                    <p>
                        <label>Contact No:</label>
                            <asp:TextBox ID="ContactTxt" runat="server" CssClass="input-medium"></asp:TextBox>   
                    </p>
                    <p>
                        <label>Address:</label>
                        <asp:TextBox ID="AddressTxt" TextMode="MultiLine" runat="server" CssClass="input-long"></asp:TextBox>
                    </p>
                    <p>
                        <label>Remarks:</label>
                        <asp:TextBox ID="RemarksTxt" TextMode="MultiLine" runat="server" CssClass="input-long"></asp:TextBox>
                    </p>
                </div> <!-- End .module-body -->
        </div> <!-- End .module -->
        <fieldset>
            <asp:Button id="SubmitBtn2" runat="server" Text="Submit" 
                CssClass="submit-green" onclick="SubmitBtn2_Click" 
                 />                                                                                                            
            <asp:Button id="SubmitBtn" runat="server" Text="Submit & ClearForm" 
                CssClass="submit-green" onclick="SubmitBtn_Click" 
                 />                                                                                                            
            <asp:Button id="CancelBtn" runat="server" Text="Clear & Cancel" 
                CssClass="submit-gray" onclick="CancelBtn_Click"  />    
        </fieldset>                                                    

    </div>
    <div class="grid_4">                
            <div class="module">
                    <h2><span>Accounts</span></h2>
                        
                    <div class="module-body">
                        <p>
                            <label>Tax ID No.:</label>
                            <asp:TextBox ID="TaxIdTxt" runat="server" CssClass="input-long"></asp:TextBox>                                    
                        </p>
                        <p>
                            <label>SSS ID No:</label>
                            <asp:TextBox ID="SSSIdNoTxt" runat="server" CssClass="input-long"></asp:TextBox>
                        </p>
                        <p>
                            <label>Pag-ibig ID No:</label>
                            <asp:TextBox ID="PagibigIdNoTxt" runat="server" CssClass="input-long"></asp:TextBox>
                        </p>
                        <p>
                            <label>PhilHealth ID No:</label>
                            <asp:TextBox ID="PhilHealthIdNoTxt" runat="server" CssClass="input-long"></asp:TextBox>
                        </p>
                    </div> <!-- End .module-body -->
            </div> <!-- End .module -->   
    </div>
    <div class="grid_4">
            <div class="module">
                    <h2><span>Employment</span></h2>
                        
                    <div class="module-body">
                        <p>                                    
                            <label>Deployed:</label>
                            <asp:DropDownList ID="DeployedDropList" runat="server" CssClass="input-long">
                            </asp:DropDownList>
                        </p> 
                        <p>                                    
                            <label>Position:</label>
                            <asp:DropDownList ID="PositionDropList" runat="server" Enabled="false" CssClass="input-long">
                            </asp:DropDownList>
                        </p> 
                        <p>
                            <label>Employed Status:</label>     
                            <asp:DropDownList ID="EmployedStatusDropDown" runat="server" CssClass="input-medium">                        
                            </asp:DropDownList>                                                   
                        </p>
                    </div> <!-- End .module-body -->
            </div> <!-- End .module -->
    </div>                   
    
                                             
    
</asp:Content>
